home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Arsenal / OS2 Arsenal v1.0 (Disc 2)(Arsenal Computer).ISO / os2_inet / progcsd.exe / IN.H < prev    next >
Encoding:
C/C++ Source or Header  |  1992-10-12  |  4.7 KB  |  134 lines

  1. /********************************************************copyrite.xmc***/
  2. /*                                                                     */
  3. /*   Licensed Materials - Property of IBM                              */
  4. /*                                                                     */
  5. /*   This module is "Restricted Materials of IBM":                     */
  6. /*      Program Number:   5798RXW                                      */
  7. /*      Program Name:     IBM TCP/IP Version 1.2 for OS/2              */
  8. /*   (C) Copyright IBM Corporation. 1990, 1991.                        */
  9. /*                                                                     */
  10. /*   See IBM Copyright Instructions.                                   */
  11. /*                                                                     */
  12. /********************************************************copyrite.xmc***/
  13. /*
  14.  * Copyright (c) 1982, 1986 Regents of the University of California.
  15.  * All rights reserved.
  16.  *
  17.  * Redistribution and use in source and binary forms are permitted
  18.  * provided that this notice is preserved and that due credit is given
  19.  * to the University of California at Berkeley. The name of the University
  20.  * may not be used to endorse or promote products derived from this
  21.  * software without specific prior written permission. This software
  22.  * is provided ``as is'' without express or implied warranty.
  23.  *
  24.  *      @(#)in.h        7.5 (Berkeley) 2/22/88
  25.  */
  26.  
  27. /*
  28.  * Constants and structures defined by the internet system,
  29.  * Per RFC 790, September 1981.
  30.  */
  31.  
  32. /*
  33.  * Protocols
  34.  */
  35. #ifndef INCL_NETINET_IN
  36. #define INCL_NETINET_IN
  37. #define IPPROTO_IP              0               /* dummy for IP */
  38. #define IPPROTO_ICMP            1               /* control message protocol */
  39. #define IPPROTO_GGP             3               /* gateway^2 (deprecated) */
  40. #define IPPROTO_TCP             6               /* tcp */
  41. #define IPPROTO_EGP             8               /* exterior gateway protocol */
  42. #define IPPROTO_PUP             12              /* pup */
  43. #define IPPROTO_UDP             17              /* user datagram protocol */
  44. #define IPPROTO_IDP             22              /* xns idp */
  45.  
  46. #define IPPROTO_RAW             255             /* raw IP packet */
  47. #define IPPROTO_MAX             256
  48.  
  49.  
  50. /*
  51.  * Ports < IPPORT_RESERVED are reserved for
  52.  * privileged processes (e.g. root).
  53.  * Ports > IPPORT_USERRESERVED are reserved
  54.  * for servers, not necessarily privileged.
  55.  */
  56. #define IPPORT_RESERVED         1024
  57. #define IPPORT_USERRESERVED     5000
  58.  
  59. /*
  60.  * Link numbers
  61.  */
  62. #define IMPLINK_IP              155
  63. #define IMPLINK_LOWEXPER        156
  64. #define IMPLINK_HIGHEXPER       158
  65.  
  66. /*
  67.  * Internet address (a structure for historical reasons)
  68.  */
  69.  
  70. struct in_addr {
  71.         u_long s_addr;
  72. };
  73.  
  74.  
  75. /*
  76.  * Definitions of bits in internet address integers.
  77.  * On subnets, the decomposition of addresses to host and net parts
  78.  * is done according to subnet mask, not the masks here.
  79.  */
  80. #define IN_CLASSA(i)            (((long)(i) & 0x80000000L) == 0)
  81. #define IN_CLASSA_NET           0xff000000L
  82. #define IN_CLASSA_NSHIFT        24
  83. #define IN_CLASSA_HOST          0x00ffffffL
  84. #define IN_CLASSA_MAX           128
  85.  
  86. #define IN_CLASSB(i)            (((long)(i) & 0xc0000000L) == 0x80000000L)
  87. #define IN_CLASSB_NET           0xffff0000L
  88. #define IN_CLASSB_NSHIFT        16
  89. #define IN_CLASSB_HOST          0x0000ffffL
  90. #define IN_CLASSB_MAX           65536L
  91.  
  92. #define IN_CLASSC(i)            (((long)(i) & 0xe0000000L) == 0xc0000000L)
  93. #define IN_CLASSC_NET           0xffffff00L
  94. #define IN_CLASSC_NSHIFT        8
  95. #define IN_CLASSC_HOST          0x000000ffL
  96.  
  97. #define IN_CLASSD(i)            (((long)(i) & 0xf0000000L) == 0xe0000000L)
  98. #define IN_MULTICAST(i)         IN_CLASSD(i)
  99.  
  100. #define IN_EXPERIMENTAL(i)      (((long)(i) & 0xe0000000L) == 0xe0000000L)
  101. #define IN_BADCLASS(i)          (((long)(i) & 0xf0000000L) == 0xf0000000L)
  102.  
  103. #define INADDR_ANY              (u_long)0x00000000L
  104. #define INADDR_BROADCAST        (u_long)0xffffffffL     /* must be masked */
  105. #ifndef KERNEL
  106. #define INADDR_NONE             0xffffffffL             /* -1 return */
  107. #endif
  108.  
  109. #define IN_LOOPBACKNET          127                     /* official! */
  110.  
  111. /*
  112.  * Socket address, internet style.
  113.  */
  114.  
  115. struct sockaddr_in {
  116.         short   sin_family;
  117.         u_short sin_port;
  118.         struct  in_addr sin_addr;
  119.         char    sin_zero[8];
  120. };
  121.  
  122. /*
  123.  * Options for use with [gs]etsockopt at the IP level.
  124.  */
  125. #define IP_OPTIONS      1               /* set/get IP per-packet options */
  126.  
  127. #ifdef KERNEL
  128. extern  struct domain inetdomain;
  129. extern  struct protosw inetsw[];
  130. struct  in_addr in_makeaddr();
  131. u_long  in_netof(), in_lnaof();
  132. #endif
  133. #endif
  134.